package hu.diploma.core.entity;

import hu.diploma.common.enums.DataSubType;
import hu.diploma.common.enums.DataType;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "personal_data_table")
public class PersonalData extends BaseEntity {

	@Column(name = "subValue")
	private String subValue;

	@Column(name = "value")
	private String value;

	@Enumerated
	@Column(name = "type")
	private DataType type;

	@Enumerated
	@Column(name = "subtype")
	private DataSubType subtype;

	@ManyToOne()
	private Person person;

	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "personalData")
	private List<Email> emails;

	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "personalData")
	private List<Call> calls;

	@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "personalData")
	private List<SmsMms> smsMms;

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public DataType getType() {
		return type;
	}

	public void setType(DataType type) {
		this.type = type;
	}

	public DataSubType getSubtype() {
		return subtype;
	}

	public void setSubtype(DataSubType subtype) {
		this.subtype = subtype;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public Person getPerson() {
		return person;
	}

}
